Conda environment management
Published:
Conda environment management
1. Important commands
- Check existing environments
conda env list
- Warning: env before list, if you type conda list env, if will show the packages installed in one of the environments.
- Create an environment
conda create -n myenv
or
conda create --name myenv
- if we want to create enviroment with specific python version:
conda create -n myenv python=3.6
- if we want to create environment with specific packages with specific version:
- if we want to create enviroment with specific python version:
conda create -n myenv scipy=0.15.0 numpy
- we can also install packages after creating environment.
conda install -n myenv scipy
- To clone(duplicate) an environment
conda create --name newenv --clone myenv
- Remove an environment
conda remove -n myenv --all
- verify the delete by
conda info --envs
or
conda env list
- verify the delete by
- Activate an environment
conda activate myenv
- Warning: there is no need for argument ‘-n’
- Deactivate an environment
conda deactivate
- Check packages in a specific environment
conda list -n myenv
- Or, if the env is already activated
conda list
- If we only want to check if a specific package is installed
conda list -n myenv scipy
- Or, if the env is already activated
2. Conda vs pip
- pip is a package manager only for Python
- venv is a environment manager only for Python
- conda is both a package and environment manager and is language agnostic(works with any languages)
3. Why it always showing module not found, even I have already installed it?
- Remember to use
conda install
instead ofpip install